package com.medusa.aps.business.modules.board.controller;

import com.medusa.aps.business.model.pagination.Page;
import com.medusa.aps.business.modules.board.model.input.WorkshopProductionDetailMultiQueryParam;
import com.medusa.aps.business.modules.board.model.input.WorkshopProductionDetailSingleQueryParam;
import com.medusa.aps.business.modules.board.model.input.WorkshopProductionStatisticsParam;
import com.medusa.aps.business.modules.board.model.output.WorkshopProductionDetailVO;
import com.medusa.aps.business.modules.board.model.output.WorkshopProductionStatisticsVO;
import com.medusa.aps.business.modules.board.mp.service.IWorkshopProductionService;
import com.medusa.aps.business.common.model.resp.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * <p>车间生产REST接口</p>
 * @author An.Yan
 */
@RequestMapping("/workshop/production")
@RestController
@RequiredArgsConstructor
@Tag(name = "车间生产看板控制层", description = "车间生产看板控制层")
public class WorkshopProductionController {

    private final IWorkshopProductionService service;


    /**
     * 分页查询车间生产统计数据
     * @param param {@link WorkshopProductionStatisticsParam}
     * @return {@link WorkshopProductionStatisticsVO}
     */
    @GetMapping("/statistics")
    @Operation(summary = "分页查询车间生产统计数据")
    public Result<WorkshopProductionStatisticsVO> selectStatistics(WorkshopProductionStatisticsParam param) {
        return Result.ok(service.pageWorkshopProductionTaskStatistics(param));
    }


    /**
     * 分页查询车间生产详情-单日
     * @param queryParam 查询参数,参考 {@link WorkshopProductionDetailSingleQueryParam}
     * @return 车间生产详情分页数据,参考 {@link WorkshopProductionDetailVO}
     */
    @GetMapping("/detail/single")
    @Operation(summary = "分页查询车间生产详情-单日")
    public Result<Page<WorkshopProductionDetailVO>> pageWorkshopProductionDetail(WorkshopProductionDetailSingleQueryParam queryParam) {
        return Result.ok(service.pageWorkshopProductionDetail(queryParam));
    }

    /**
     * 分页查询车间生产详情-多日
     * @param queryParam 查询参数,参考 {@link WorkshopProductionDetailMultiQueryParam}
     * @return 车间生产详情分页数据,参考 {@link WorkshopProductionDetailVO}
     */
    @GetMapping("/detail/multi")
    @Operation(summary = "分页查询车间生产详情-多日")
    public Result<Page<WorkshopProductionDetailVO>> pageWorkshopProductionDetail(WorkshopProductionDetailMultiQueryParam queryParam) {
        return Result.ok(service.pageWorkshopProductionDetail(queryParam));
    }
}
